package com.news.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.news.service.NewsService;

@WebServlet("/adminnewsdelete")
public class AdminNewsDeleteServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String id = request.getParameter("id");
		// 根据id删除数据
		NewsService newsService = new NewsService();
		boolean flag = newsService.deleteNews(Integer.parseInt(id));
		if (flag) {
			response.sendRedirect(request.getContextPath()+"/adminnewslist");
		}
	}
}
